import React, { Component } from 'react'
import styles from './index.less'
import arrowImg from '@/assets/imgs/long_arrow@2x.png'
class AirlineInfo extends Component {
  render() {
    const { airports } = this.props
    let start = airports[0], end = airports[airports.length - 1]
    return (
      <div className={styles.container}>
        <div className={styles.start}>
          <span className={styles.name}>{start.cityName}({start.code})</span>
          <span className={styles.airport}>{start.name}</span>
        </div>
        <div className={styles.stopInfo}>
          <img src={arrowImg} className={styles.arrow} alt="" />
          {airports.length > 2 &&
            <span className={styles.stops}>经停{airports.length - 2}次</span>
          }
        </div>
        <div className={styles.end}>
          <span className={styles.name}>{end.cityName}({end.code})</span>
          <span className={styles.airport}>{end.name}</span>
        </div>
      </div>
    )
  }
}
export default AirlineInfo
